linux添加新用户roomnumber,Ubuntu及CentOS如何创建、删除、修改用户以及提升用户权限...

您所在的位置:网站首页 number phone什么意思 linux添加新用户roomnumber,Ubuntu及CentOS如何创建、删除、修改用户以及提升用户权限...

linux添加新用户roomnumber,Ubuntu及CentOS如何创建、删除、修改用户以及提升用户权限...

2024-01-23 15:44| 来源: 网络整理| 查看: 265

在云服务器中,我们通常使用的是Linux系统,以Ubuntu及CentOS为例,要想添加一个新用户,首先使用root用户登陆我们的服务器:

$ ssh root@my-server-public-ip

请用你的服务器公共ip替换上面的my-server-public-ip。

要添加一个用户名为test的用户,我们可以使用adduser命令:

$ sudo adduser test

Adding user `test' ...

Adding new group `test' (1001) ...

Adding new user `test' (1001) with group `test' ...

The home directory `/home/test' already exists. Not copying from `/etc/skel'.

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

Changing the user information for test

Enter the new value, or press ENTER for the default

Full Name []:

Room Number []:

Work Phone []:

Home Phone []:

Other []:

Is the information correct? [Y/n] y

注意,在填写除了密码以外的信息时,我们可以直接按回车保留默认值。

要更改这个用户的密码,我们需要使用passwd命令:

$ sudo passwd test

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

我们创建的用户默认是没有root权限的。要给予这个用户root权限,

在Ubuntu系统下,我们可以将用户添加到sudo分组:

$ sudo usermod -aG sudo test

在CentOS下,我们需要将用户添加到wheel分组:

$ sudo usermod -aG wheel test

如果需要了解更多关于root权限的修改,请参考:

那么如果我们想删除这个用户,我们可以使用deluser:

$ sudo deluser test

Removing user `test' ...

Warning: group `test' has no more members.

Done.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3